package com.briup.estore.dao.impl;

import com.briup.estore.common.pojo.OrderItem;
import com.briup.estore.common.utils.JDBCUtils;
import com.briup.estore.dao.OrderItemDao;

import java.util.List;

/**
 * @Author briup-adam
 * @Date 2023/8/3 下午3:02
 * @Description 对表【es_order_item】的数据库操作
 **/

public class OrderItemDaoImpl implements OrderItemDao {
    @Override
    public void save(OrderItem orderItem) {
        JDBCUtils.DML("insert into es_order_item (order_id,book_id,num) values (?,?,?);",orderItem.getOrderId(),orderItem.getBookId(),orderItem.getNum());
    }

    @Override
    public List<OrderItem> selectByOrderId(String orderId) {
        List<OrderItem> list = JDBCUtils.findMany("select id,order_id,book_id,num from es_order_item where order_id =?;", OrderItem.class, orderId);
        return list;
    }
}
